package viewControl;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.Timer;
import model.*;

public class GUI extends javax.swing.JFrame {

    private JTable mainTable;
    private Bud aktivBud;
    private Kunde aktivKunde;
    private Ordre aktivOrdre;
    private String budFornavn;
    private String budEfternavn;
    private String toppingnavn;
    private String kundeFornavn;
    private String kundeEfternavn;
    private String pizzanavn;
    private boolean isAdmin;
    private boolean isKunde;
    private boolean isBud;
    private boolean isKok;
    private ArrayList pizzaDerSkalLaves;
    private ArrayList pizzaDerBliverLavet;
    private ArrayList pizzaDone;
    private ArrayList newPizzaToppingsList;
    private ArrayList<Ordre> waitToGetOnTheWayList;
    private ArrayList onTheWayList;
    private ArrayList bestillingsArrayList;
    private ArrayList kundeList1;
    private ArrayList kundeList2;
    private DBHandler dbh;
    private int row;
    Timer tKundeStatus;
    Timer tKoekkenOrdreList;
    Timer tBudOrdreList;
    private int pizzaTotalPris;
    private ArrayList<Integer> prisArray;
    private String sqlFejl = "Der er sket en fejl med databasen. Fejlkode: ";
    private String nullFejl = "Der er sket en fejl med valget. Fejlkode: ";
    private String arrayIndexFejl = "Fejlkode: ";

    public GUI(int brugernr, DBHandler dbh) throws SQLException {
        pizzaDerSkalLaves = new ArrayList();
        waitToGetOnTheWayList = new ArrayList();
        onTheWayList = new ArrayList();
        bestillingsArrayList = new ArrayList();
        kundeList1 = new ArrayList();
        kundeList2 = new ArrayList();
        newPizzaToppingsList = new ArrayList();
        aktivOrdre = new Ordre();
        prisArray = new ArrayList();
        this.dbh = dbh;
        isAdmin = false;
        isKunde = false;
        isBud = false;
        isKok = false;

        switch (brugernr) {
            case 0:
                isAdmin = true;
                break;
            case 1:
                isKunde = true;
                break;
            case 2:
                isBud = true;
                break;
            case 3:
                isKok = true;
                break;
        }

        if (isAdmin || isKunde) {
            Object[][] o = null;
            Object[] h = {
                "Pizza",
                "Størrelse",
                "Pris"
            };

            o = Pizza.pizzaList(dbh);

            mainTable = new javax.swing.JTable();
            mainTable.setModel(new javax.swing.table.DefaultTableModel(o, h) {

                boolean[] canEdit = new boolean[]{
                    false, false, false
                };

                public boolean isCellEditable(int rowIndex, int columnIndex) {
                    return canEdit[columnIndex];
                }
            });

            mainTable.getColumnModel().getColumn(0).setResizable(false);
            mainTable.getColumnModel().getColumn(0).setPreferredWidth(200);
            mainTable.getColumnModel().getColumn(1).setResizable(false);
            mainTable.getColumnModel().getColumn(1).setPreferredWidth(100);
            mainTable.getColumnModel().getColumn(2).setResizable(false);
            mainTable.getColumnModel().getColumn(2).setPreferredWidth(100);
        }

        initComponents();

        tKundeStatus = new Timer(1000, new ActionListenerImpl());
        tKoekkenOrdreList = new Timer(1000, new ActionListenerImpl());
        tBudOrdreList = new Timer(1000, new ActionListenerImpl());

        setLocationRelativeTo(null);
        if (isKok) {
            tKoekkenOrdreList.start();
        }

        if (isAdmin || isKunde) {
            kundeScrollPane.setBounds(0, 0, kundePanel.getWidth(), kundePanel.getHeight());
            kundeScrollPane.setViewportView(mainTable);
        }
        if (isAdmin) {
            aktivKunde = dbh.getKunde(1); //Hardcoded kunde ved login. Kd 1 == Admin.
            aktivOrdre = new Ordre();
            aktivOrdre.setKundeId(aktivKunde.getKundeId());
            aktivKundeNavnLabel.setText(aktivKunde.getForNavn() + " " + aktivKunde.getEfterNavn());
        }

        if (isKunde) {
            aktivKunde = dbh.getKunde(2); //Hardcoded kunde ved login.
            aktivOrdre = new Ordre();
            aktivOrdre.setKundeId(aktivKunde.getKundeId());
            aktivKundeNavnLabel.setText(aktivKunde.getForNavn() + " " + aktivKunde.getEfterNavn());
            updateKundeOrdre(aktivKunde);
            kundePanel.setVisible(true);
            budPanel.setVisible(false);
            kokPanel.setVisible(false);
            jMenu2.setVisible(false);
            pizzaMenuItem.setVisible(false);
            toppingMenuItem.setVisible(false);
            ordreMenuItem.setVisible(false);
            budMenuItem.setVisible(false);
        }

        if (isBud) {
            tBudOrdreList.start();
            kundePanel.setVisible(false);
            budPanel.setVisible(true);
            kokPanel.setVisible(false);
            jMenu2.setVisible(false);
            kundeMenuItem.setVisible(false);
            pizzaMenuItem.setVisible(false);
            toppingMenuItem.setVisible(false);
            ordreMenuItem.setVisible(false);
        }

        if (isKok) {
            kundePanel.setVisible(false);
            budPanel.setVisible(false);
            kokPanel.setVisible(true);
            jMenu2.setVisible(false);
            kundeMenuItem.setVisible(false);
            budMenuItem.setVisible(false);
        }
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        menubuttonGroup = new javax.swing.ButtonGroup();
        pizzaDialog = new javax.swing.JDialog();
        pizzaNavnTextField = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        pizzaButton = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        toppingScrollPane1 = new javax.swing.JScrollPane();
        toppingList1 = new javax.swing.JList();
        toppingScrollPane2 = new javax.swing.JScrollPane();
        toppingList2 = new javax.swing.JList();
        arrowButton = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        storPizzaKosterTextField = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        pizzaGemButton = new javax.swing.JButton();
        pizzaSletButton = new javax.swing.JButton();
        mellemPizzaKosterTextField = new javax.swing.JTextField();
        lillePizzaKosterTextField = new javax.swing.JTextField();
        jLabel30 = new javax.swing.JLabel();
        jLabel31 = new javax.swing.JLabel();
        jLabel32 = new javax.swing.JLabel();
        jLabel33 = new javax.swing.JLabel();
        jLabel34 = new javax.swing.JLabel();
        budDialog = new javax.swing.JDialog();
        jLabel8 = new javax.swing.JLabel();
        budFornavnTextField = new javax.swing.JTextField();
        budButton = new javax.swing.JButton();
        budGemButton = new javax.swing.JButton();
        budSletButton = new javax.swing.JButton();
        jLabel9 = new javax.swing.JLabel();
        budNytEfternavnTextField = new javax.swing.JTextField();
        budEfternavnTextField = new javax.swing.JTextField();
        budNytFornavnTextField = new javax.swing.JTextField();
        jLabel35 = new javax.swing.JLabel();
        jLabel36 = new javax.swing.JLabel();
        toppingDialog = new javax.swing.JDialog();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        toppingButton = new javax.swing.JButton();
        toppingNavnTextField = new javax.swing.JTextField();
        toppingNytNavnTextField = new javax.swing.JTextField();
        toppingGemButton = new javax.swing.JButton();
        toppingSletButton = new javax.swing.JButton();
        ordreDialog = new javax.swing.JDialog();
        jLabel12 = new javax.swing.JLabel();
        jComboBox1 = new javax.swing.JComboBox();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        kundeDialog = new javax.swing.JDialog();
        jLabel14 = new javax.swing.JLabel();
        kundeFornavnTextField = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        adresseTextField = new javax.swing.JTextField();
        postNrTextField = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        bynavnTextField = new javax.swing.JTextField();
        kundeButton = new javax.swing.JButton();
        kundeGemButton = new javax.swing.JButton();
        kundeSletButton = new javax.swing.JButton();
        jLabel20 = new javax.swing.JLabel();
        tlfTextField = new javax.swing.JTextField();
        jLabel29 = new javax.swing.JLabel();
        kundeEfternavnTextField = new javax.swing.JTextField();
        bestilDialog = new javax.swing.JDialog();
        jLabel25 = new javax.swing.JLabel();
        jComboBox2 = new javax.swing.JComboBox();
        jComboBox3 = new javax.swing.JComboBox();
        jComboBox4 = new javax.swing.JComboBox();
        jLabel26 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        bestilMedTidButton = new javax.swing.JButton();
        kundePanel = new javax.swing.JPanel();
        kundeScrollPane = new javax.swing.JScrollPane();
        addPizzaButton = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        bestillingsList = new javax.swing.JList();
        jLabel13 = new javax.swing.JLabel();
        ialtLabel = new javax.swing.JLabel();
        kundeOrderComboBox = new javax.swing.JComboBox();
        jLabel18 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        ordreBeskrivelseTextArea = new javax.swing.JTextArea();
        statusKundeProgressBar = new javax.swing.JProgressBar();
        jLabel19 = new javax.swing.JLabel();
        statusLabelKunde = new javax.swing.JLabel();
        bestilButton = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        pizzaAntalTextField = new javax.swing.JTextField();
        fjernPizzaButton = new javax.swing.JButton();
        aktivKundeNavnLabel = new javax.swing.JLabel();
        budPanel = new javax.swing.JPanel();
        leveretButton = new javax.swing.JButton();
        jScrollPane8 = new javax.swing.JScrollPane();
        frakokkenList = new javax.swing.JList();
        jScrollPane9 = new javax.swing.JScrollPane();
        budUdbringningList = new javax.swing.JList();
        tilUdbringningButton = new javax.swing.JButton();
        jLabel27 = new javax.swing.JLabel();
        jLabel28 = new javax.swing.JLabel();
        kokPanel = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        pizzaDerSkalLavesList = new javax.swing.JList();
        startPizzaButton = new javax.swing.JButton();
        pizzaOrdreDoneButton = new javax.swing.JButton();
        jScrollPane5 = new javax.swing.JScrollPane();
        AlleOrdreList = new javax.swing.JList();
        jLabel21 = new javax.swing.JLabel();
        jScrollPane6 = new javax.swing.JScrollPane();
        pizzaDerErDoneList = new javax.swing.JList();
        jLabel22 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        jScrollPane7 = new javax.swing.JScrollPane();
        pizzaVedAtBliveLavetList = new javax.swing.JList();
        jLabel24 = new javax.swing.JLabel();
        pizzaSetDoneButton = new javax.swing.JButton();
        statusKokProgressBar = new javax.swing.JProgressBar();
        jLabel1 = new javax.swing.JLabel();
        statusLabelKok = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        kundeMenuItem = new javax.swing.JMenuItem();
        pizzaMenuItem = new javax.swing.JMenuItem();
        budMenuItem = new javax.swing.JMenuItem();
        toppingMenuItem = new javax.swing.JMenuItem();
        ordreMenuItem = new javax.swing.JMenuItem();
        lukMenuItem = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        kundeRadioButtonMenu = new javax.swing.JRadioButtonMenuItem();
        budRadioButtonMenu = new javax.swing.JRadioButtonMenuItem();
        kokRadioButtonMenu = new javax.swing.JRadioButtonMenuItem();

        pizzaDialog.setTitle("Opret/rediger pizza");
        pizzaDialog.setLocationByPlatform(true);
        pizzaDialog.setMinimumSize(new java.awt.Dimension(304, 350));
        pizzaDialog.setResizable(false);

        jLabel3.setText("Pizza navn");

        pizzaButton.setText("Rediger/Opret ny");
        pizzaButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                pizzaButtonActionPerformed(evt);
            }
        });

        jLabel4.setText("Topping");

        toppingList1.setEnabled(false);
        toppingScrollPane1.setViewportView(toppingList1);

        toppingList2.setEnabled(false);
        toppingScrollPane2.setViewportView(toppingList2);

        arrowButton.setText(">");
        arrowButton.setEnabled(false);
        arrowButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                arrowButtonActionPerformed(evt);
            }
        });

        jLabel5.setText("Topping på pizza");

        storPizzaKosterTextField.setEnabled(false);

        jLabel6.setText("Pris for størrelserne");

        jLabel7.setText("kr");

        pizzaGemButton.setText("Gem");
        pizzaGemButton.setEnabled(false);
        pizzaGemButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                pizzaGemButtonActionPerformed(evt);
            }
        });

        pizzaSletButton.setText("Slet");
        pizzaSletButton.setEnabled(false);
        pizzaSletButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                pizzaSletButtonActionPerformed(evt);
            }
        });

        mellemPizzaKosterTextField.setEnabled(false);

        lillePizzaKosterTextField.setEnabled(false);

        jLabel30.setText("lille");

        jLabel31.setText("Mellem");

        jLabel32.setText("Stor");

        jLabel33.setText("kr");

        jLabel34.setText("kr");

        javax.swing.GroupLayout pizzaDialogLayout = new javax.swing.GroupLayout(pizzaDialog.getContentPane());
        pizzaDialog.getContentPane().setLayout(pizzaDialogLayout);
        pizzaDialogLayout.setHorizontalGroup(
            pizzaDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pizzaDialogLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pizzaDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pizzaDialogLayout.createSequentialGroup()
                        .addGroup(pizzaDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel3)
                            .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(pizzaNavnTextField))
                    .addGroup(pizzaDialogLayout.createSequentialGroup()
                        .addGroup(pizzaDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel30)
                            .addComponent(jLabel31)
                            .addComponent(jLabel32))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pizzaDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(storPizzaKosterTextField)
                            .addComponent(mellemPizzaKosterTextField)
                            .addComponent(lillePizzaKosterTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pizzaDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pizzaDialogLayout.createSequentialGroup()
                                .addComponent(jLabel7)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(pizzaSletButton)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(pizzaGemButton))
                            .addGroup(pizzaDialogLayout.createSequentialGroup()
                                .addGroup(pizzaDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel33)
                                    .addComponent(jLabel34))
                                .addGap(0, 0, Short.MAX_VALUE))))
                    .addGroup(pizzaDialogLayout.createSequentialGroup()
                        .addGroup(pizzaDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(pizzaButton)
                            .addGroup(pizzaDialogLayout.createSequentialGroup()
                                .addComponent(toppingScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(arrowButton)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(pizzaDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel5)
                                    .addComponent(toppingScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(jLabel6))
                        .addGap(0, 19, Short.MAX_VALUE)))
                .addContainerGap())
        );
        pizzaDialogLayout.setVerticalGroup(
            pizzaDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pizzaDialogLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pizzaDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(pizzaNavnTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addGroup(pizzaDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(pizzaDialogLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(toppingScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pizzaDialogLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(pizzaButton)
                        .addGroup(pizzaDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pizzaDialogLayout.createSequentialGroup()
                                .addGap(11, 11, 11)
                                .addComponent(jLabel4)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(toppingScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(pizzaDialogLayout.createSequentialGroup()
                                .addGap(62, 62, 62)
                                .addComponent(arrowButton)))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11, Short.MAX_VALUE)
                .addGroup(pizzaDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lillePizzaKosterTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel30)
                    .addComponent(jLabel34))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pizzaDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(mellemPizzaKosterTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel31)
                    .addComponent(jLabel33))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pizzaDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(pizzaGemButton)
                    .addComponent(storPizzaKosterTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7)
                    .addComponent(pizzaSletButton)
                    .addComponent(jLabel32))
                .addContainerGap())
        );

        budDialog.setTitle("Opret/rediger bud");
        budDialog.setMinimumSize(new java.awt.Dimension(240, 250));
        budDialog.setResizable(false);

        jLabel8.setText("Fornavn");

        budButton.setText("Opret/rediger");
        budButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                budButtonActionPerformed(evt);
            }
        });

        budGemButton.setText("Gem");
        budGemButton.setEnabled(false);
        budGemButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                budGemButtonActionPerformed(evt);
            }
        });

        budSletButton.setText("Slet");
        budSletButton.setEnabled(false);
        budSletButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                budSletButtonActionPerformed(evt);
            }
        });

        jLabel9.setText("Nyt efternavn");

        budNytEfternavnTextField.setEnabled(false);

        budNytFornavnTextField.setEnabled(false);

        jLabel35.setText("Efternavn");

        jLabel36.setText("Nyt fornavn");

        javax.swing.GroupLayout budDialogLayout = new javax.swing.GroupLayout(budDialog.getContentPane());
        budDialog.getContentPane().setLayout(budDialogLayout);
        budDialogLayout.setHorizontalGroup(
            budDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(budDialogLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(budDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(budDialogLayout.createSequentialGroup()
                        .addComponent(budButton)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, budDialogLayout.createSequentialGroup()
                        .addGap(0, 110, Short.MAX_VALUE)
                        .addComponent(budSletButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(budGemButton))
                    .addGroup(budDialogLayout.createSequentialGroup()
                        .addGroup(budDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8)
                            .addComponent(jLabel35))
                        .addGap(18, 18, 18)
                        .addGroup(budDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(budFornavnTextField)
                            .addComponent(budEfternavnTextField)))
                    .addGroup(budDialogLayout.createSequentialGroup()
                        .addGroup(budDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel9)
                            .addComponent(jLabel36))
                        .addGap(18, 18, 18)
                        .addGroup(budDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(budNytFornavnTextField, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(budNytEfternavnTextField))))
                .addContainerGap())
        );
        budDialogLayout.setVerticalGroup(
            budDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(budDialogLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(budDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(budFornavnTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(8, 8, 8)
                .addGroup(budDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(budEfternavnTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel35))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(budButton)
                .addGap(18, 18, 18)
                .addGroup(budDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(budNytFornavnTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel36))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 9, Short.MAX_VALUE)
                .addGroup(budDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(budNytEfternavnTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(budDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(budGemButton)
                    .addComponent(budSletButton))
                .addContainerGap())
        );

        toppingDialog.setTitle("Opret/rediger topping");
        toppingDialog.setMinimumSize(new java.awt.Dimension(280, 200));
        toppingDialog.setResizable(false);

        jLabel10.setText("Topping navn");

        jLabel11.setText("Nyt navn");

        toppingButton.setText("Opret/rediger");
        toppingButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                toppingButtonActionPerformed(evt);
            }
        });

        toppingNytNavnTextField.setEnabled(false);

        toppingGemButton.setText("Gem");
        toppingGemButton.setEnabled(false);
        toppingGemButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                toppingGemButtonActionPerformed(evt);
            }
        });

        toppingSletButton.setText("Slet");
        toppingSletButton.setEnabled(false);
        toppingSletButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                toppingSletButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout toppingDialogLayout = new javax.swing.GroupLayout(toppingDialog.getContentPane());
        toppingDialog.getContentPane().setLayout(toppingDialogLayout);
        toppingDialogLayout.setHorizontalGroup(
            toppingDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(toppingDialogLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(toppingDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(toppingDialogLayout.createSequentialGroup()
                        .addComponent(jLabel10)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(toppingNavnTextField))
                    .addGroup(toppingDialogLayout.createSequentialGroup()
                        .addComponent(toppingButton)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(toppingDialogLayout.createSequentialGroup()
                        .addComponent(jLabel11)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(toppingNytNavnTextField))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, toppingDialogLayout.createSequentialGroup()
                        .addGap(0, 123, Short.MAX_VALUE)
                        .addComponent(toppingSletButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(toppingGemButton)))
                .addContainerGap())
        );
        toppingDialogLayout.setVerticalGroup(
            toppingDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(toppingDialogLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(toppingDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(toppingNavnTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(toppingButton)
                .addGap(15, 15, 15)
                .addGroup(toppingDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(toppingNytNavnTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 30, Short.MAX_VALUE)
                .addGroup(toppingDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(toppingGemButton)
                    .addComponent(toppingSletButton))
                .addContainerGap())
        );

        ordreDialog.setMinimumSize(new java.awt.Dimension(280, 200));

        jLabel12.setText("Ordre ID");

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jButton3.setText("Gem");

        jButton4.setText("Slet");

        javax.swing.GroupLayout ordreDialogLayout = new javax.swing.GroupLayout(ordreDialog.getContentPane());
        ordreDialog.getContentPane().setLayout(ordreDialogLayout);
        ordreDialogLayout.setHorizontalGroup(
            ordreDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ordreDialogLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(ordreDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, ordreDialogLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jButton4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton3))
                    .addGroup(ordreDialogLayout.createSequentialGroup()
                        .addComponent(jLabel12)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        ordreDialogLayout.setVerticalGroup(
            ordreDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ordreDialogLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(ordreDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel12)
                    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(ordreDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton3)
                    .addComponent(jButton4))
                .addContainerGap())
        );

        kundeDialog.setMinimumSize(new java.awt.Dimension(300, 320));

        jLabel14.setText("Fornavn");

        jLabel15.setText("Adresse");

        adresseTextField.setEnabled(false);

        postNrTextField.setEnabled(false);

        jLabel16.setText("Post nr.");

        jLabel17.setText("Bynavn");

        bynavnTextField.setEnabled(false);

        kundeButton.setText("Opret/rediger");
        kundeButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                kundeButtonActionPerformed(evt);
            }
        });

        kundeGemButton.setText("Gem");
        kundeGemButton.setEnabled(false);
        kundeGemButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                kundeGemButtonActionPerformed(evt);
            }
        });

        kundeSletButton.setText("Slet");
        kundeSletButton.setEnabled(false);
        kundeSletButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                kundeSletButtonActionPerformed(evt);
            }
        });

        jLabel20.setText("Tlf nr.");

        tlfTextField.setEnabled(false);

        jLabel29.setText("Efternavn");

        javax.swing.GroupLayout kundeDialogLayout = new javax.swing.GroupLayout(kundeDialog.getContentPane());
        kundeDialog.getContentPane().setLayout(kundeDialogLayout);
        kundeDialogLayout.setHorizontalGroup(
            kundeDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(kundeDialogLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(kundeDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, kundeDialogLayout.createSequentialGroup()
                        .addGap(0, 135, Short.MAX_VALUE)
                        .addComponent(kundeSletButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(kundeGemButton))
                    .addGroup(kundeDialogLayout.createSequentialGroup()
                        .addComponent(jLabel15)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(adresseTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 202, Short.MAX_VALUE))
                    .addGroup(kundeDialogLayout.createSequentialGroup()
                        .addGroup(kundeDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel17)
                            .addComponent(jLabel16)
                            .addComponent(jLabel20))
                        .addGap(5, 5, 5)
                        .addGroup(kundeDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(tlfTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 202, Short.MAX_VALUE)
                            .addComponent(postNrTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 202, Short.MAX_VALUE)
                            .addComponent(bynavnTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 202, Short.MAX_VALUE)))
                    .addGroup(kundeDialogLayout.createSequentialGroup()
                        .addComponent(kundeButton)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(kundeDialogLayout.createSequentialGroup()
                        .addGroup(kundeDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel29)
                            .addComponent(jLabel14))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(kundeDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(kundeFornavnTextField)
                            .addComponent(kundeEfternavnTextField))))
                .addContainerGap())
        );
        kundeDialogLayout.setVerticalGroup(
            kundeDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(kundeDialogLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(kundeDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel14)
                    .addComponent(kundeFornavnTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(kundeDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel29)
                    .addComponent(kundeEfternavnTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(kundeButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE)
                .addGroup(kundeDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(adresseTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(kundeDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(postNrTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel16))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(kundeDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(bynavnTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(kundeDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel20)
                    .addComponent(tlfTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(kundeDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(kundeGemButton)
                    .addComponent(kundeSletButton))
                .addContainerGap())
        );

        bestilDialog.setLocationByPlatform(true);
        bestilDialog.setMinimumSize(new java.awt.Dimension(200, 200));
        bestilDialog.setResizable(false);

        jLabel25.setText("Dato og tid for bestilling");

        jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Dato" }));
        jComboBox2.setEnabled(false);

        jComboBox3.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Måned" }));
        jComboBox3.setEnabled(false);

        jComboBox4.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "År" }));
        jComboBox4.setEnabled(false);

        jLabel26.setText("Klokken");

        jTextField1.setText("00:00");
        jTextField1.setEnabled(false);

        bestilMedTidButton.setText("Bestil");
        bestilMedTidButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bestilMedTidButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout bestilDialogLayout = new javax.swing.GroupLayout(bestilDialog.getContentPane());
        bestilDialog.getContentPane().setLayout(bestilDialogLayout);
        bestilDialogLayout.setHorizontalGroup(
            bestilDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(bestilDialogLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(bestilDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel25)
                    .addGroup(bestilDialogLayout.createSequentialGroup()
                        .addGroup(bestilDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel26))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(bestilDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(bestilMedTidButton)
                            .addGroup(bestilDialogLayout.createSequentialGroup()
                                .addGroup(bestilDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(jTextField1, javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jComboBox3, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        bestilDialogLayout.setVerticalGroup(
            bestilDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(bestilDialogLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel25)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(bestilDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(bestilDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel26)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(28, 28, 28)
                .addComponent(bestilMedTidButton)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("PizzaSystem v0.1");
        setMinimumSize(new java.awt.Dimension(800, 600));
        setResizable(false);
        getContentPane().setLayout(null);

        kundePanel.setToolTipText("");
        kundePanel.addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentResized(java.awt.event.ComponentEvent evt) {
                kundePanelComponentResized(evt);
            }
        });

        addPizzaButton.setText("Tilføj Pizza");
        addPizzaButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addPizzaButtonActionPerformed(evt);
            }
        });

        jScrollPane1.setViewportView(bestillingsList);

        jLabel13.setText("Ialt:");

        ialtLabel.setText("0 Kr,-");

        kundeOrderComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Ordre" }));
        kundeOrderComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                kundeOrderComboBoxActionPerformed(evt);
            }
        });

        jLabel18.setText("Igangværende/Færdige ordre");

        ordreBeskrivelseTextArea.setColumns(20);
        ordreBeskrivelseTextArea.setEditable(false);
        ordreBeskrivelseTextArea.setRows(5);
        jScrollPane2.setViewportView(ordreBeskrivelseTextArea);

        statusKundeProgressBar.setMaximum(5);

        jLabel19.setText("Status:");

        statusLabelKunde.setText("Besked");

        bestilButton.setText("Bestil");
        bestilButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bestilButtonActionPerformed(evt);
            }
        });

        jLabel2.setText("Antal:");

        pizzaAntalTextField.setText("1");

        fjernPizzaButton.setText("Fjern Pizza");
        fjernPizzaButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fjernPizzaButtonActionPerformed(evt);
            }
        });

        aktivKundeNavnLabel.setText("Kunde navn");

        javax.swing.GroupLayout kundePanelLayout = new javax.swing.GroupLayout(kundePanel);
        kundePanel.setLayout(kundePanelLayout);
        kundePanelLayout.setHorizontalGroup(
            kundePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(kundePanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(kundePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(kundeScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE)
                    .addComponent(aktivKundeNavnLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(kundePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(kundePanelLayout.createSequentialGroup()
                        .addComponent(jLabel19)
                        .addGap(23, 23, 23)
                        .addComponent(statusLabelKunde)
                        .addContainerGap())
                    .addGroup(kundePanelLayout.createSequentialGroup()
                        .addGroup(kundePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(kundePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(statusKundeProgressBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 238, Short.MAX_VALUE)
                                .addComponent(kundeOrderComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addComponent(jLabel18)
                            .addGroup(kundePanelLayout.createSequentialGroup()
                                .addGap(2, 2, 2)
                                .addGroup(kundePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(kundePanelLayout.createSequentialGroup()
                                        .addComponent(jLabel13)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(ialtLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(bestilButton)
                                    .addGroup(kundePanelLayout.createSequentialGroup()
                                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 222, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(kundePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(kundePanelLayout.createSequentialGroup()
                                                .addComponent(jLabel2)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(pizzaAntalTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addComponent(addPizzaButton)
                                            .addComponent(fjernPizzaButton))))))
                        .addGap(0, 56, Short.MAX_VALUE))))
        );
        kundePanelLayout.setVerticalGroup(
            kundePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(kundePanelLayout.createSequentialGroup()
                .addComponent(aktivKundeNavnLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(kundePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(kundeScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 489, Short.MAX_VALUE)
                    .addGroup(kundePanelLayout.createSequentialGroup()
                        .addGroup(kundePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(kundePanelLayout.createSequentialGroup()
                                .addGroup(kundePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel2)
                                    .addComponent(pizzaAntalTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(addPizzaButton)
                                .addGap(23, 23, 23)
                                .addComponent(fjernPizzaButton)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(kundePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel13)
                            .addComponent(ialtLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(bestilButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabel18)
                        .addGap(28, 28, 28)
                        .addComponent(kundeOrderComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(statusKundeProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addGroup(kundePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel19)
                            .addComponent(statusLabelKunde))))
                .addContainerGap())
        );

        getContentPane().add(kundePanel);
        kundePanel.setBounds(2, 4, 790, 520);

        leveretButton.setText("Sæt til leveret");
        leveretButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                leveretButtonActionPerformed(evt);
            }
        });

        jScrollPane8.setViewportView(frakokkenList);

        jScrollPane9.setViewportView(budUdbringningList);

        tilUdbringningButton.setFont(new java.awt.Font("Times New Roman", 1, 48)); // NOI18N
        tilUdbringningButton.setText(">");
        tilUdbringningButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tilUdbringningButtonActionPerformed(evt);
            }
        });

        jLabel27.setText("Pizzaer der skal udbringes");

        jLabel28.setText("Pizzaer til udbringning");

        javax.swing.GroupLayout budPanelLayout = new javax.swing.GroupLayout(budPanel);
        budPanel.setLayout(budPanelLayout);
        budPanelLayout.setHorizontalGroup(
            budPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(budPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(budPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(budPanelLayout.createSequentialGroup()
                        .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(tilUdbringningButton))
                    .addComponent(jLabel27))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(budPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(budPanelLayout.createSequentialGroup()
                        .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(leveretButton))
                    .addComponent(jLabel28))
                .addContainerGap(98, Short.MAX_VALUE))
        );
        budPanelLayout.setVerticalGroup(
            budPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(budPanelLayout.createSequentialGroup()
                .addGap(30, 30, 30)
                .addGroup(budPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel27)
                    .addComponent(jLabel28))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(budPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(budPanelLayout.createSequentialGroup()
                        .addComponent(leveretButton, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 149, Short.MAX_VALUE)
                        .addComponent(tilUdbringningButton, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(218, 218, 218))
                    .addGroup(budPanelLayout.createSequentialGroup()
                        .addGroup(budPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane8)
                            .addComponent(jScrollPane9))
                        .addContainerGap())))
        );

        getContentPane().add(budPanel);
        budPanel.setBounds(0, 0, 790, 520);

        pizzaDerSkalLavesList.setBackground(new java.awt.Color(255, 153, 153));
        jScrollPane4.setViewportView(pizzaDerSkalLavesList);

        startPizzaButton.setText("Start valgte pizza");
        startPizzaButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                startPizzaButtonActionPerformed(evt);
            }
        });

        pizzaOrdreDoneButton.setText("Send ordre til udbringning");
        pizzaOrdreDoneButton.setEnabled(false);
        pizzaOrdreDoneButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                pizzaOrdreDoneButtonActionPerformed(evt);
            }
        });

        AlleOrdreList.setBackground(new java.awt.Color(255, 255, 204));
        AlleOrdreList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                AlleOrdreListValueChanged(evt);
            }
        });
        jScrollPane5.setViewportView(AlleOrdreList);

        jLabel21.setText("Pizzaer der skal laves");

        pizzaDerErDoneList.setBackground(new java.awt.Color(153, 255, 51));
        jScrollPane6.setViewportView(pizzaDerErDoneList);

        jLabel22.setText("Pizzaer der er færdige");

        jLabel23.setText("Alle nuværende ordre");

        pizzaVedAtBliveLavetList.setBackground(new java.awt.Color(255, 255, 102));
        jScrollPane7.setViewportView(pizzaVedAtBliveLavetList);

        jLabel24.setBackground(new java.awt.Color(255, 255, 102));
        jLabel24.setText("Pizzaer ved at blive lavet");

        pizzaSetDoneButton.setText("Sæt valgte pizza til færdig");
        pizzaSetDoneButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                pizzaSetDoneButtonActionPerformed(evt);
            }
        });

        statusKokProgressBar.setMaximum(5);

        jLabel1.setText("Status:");

        statusLabelKok.setText("Besked");

        javax.swing.GroupLayout kokPanelLayout = new javax.swing.GroupLayout(kokPanel);
        kokPanel.setLayout(kokPanelLayout);
        kokPanelLayout.setHorizontalGroup(
            kokPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(kokPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(kokPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel23)
                    .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 212, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(kokPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(statusKokProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 528, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(kokPanelLayout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(statusLabelKok))
                    .addGroup(kokPanelLayout.createSequentialGroup()
                        .addGroup(kokPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(kokPanelLayout.createSequentialGroup()
                                .addGroup(kokPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(startPizzaButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(kokPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(pizzaSetDoneButton, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel24)))
                            .addComponent(jLabel21))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(kokPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(pizzaOrdreDoneButton, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel22))))
                .addGap(0, 34, Short.MAX_VALUE))
        );
        kokPanelLayout.setVerticalGroup(
            kokPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(kokPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(kokPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(kokPanelLayout.createSequentialGroup()
                        .addGroup(kokPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(kokPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel21)
                                .addComponent(jLabel24))
                            .addComponent(jLabel22, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(kokPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(kokPanelLayout.createSequentialGroup()
                                .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(kokPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(pizzaSetDoneButton)
                                    .addComponent(startPizzaButton)))
                            .addGroup(kokPanelLayout.createSequentialGroup()
                                .addGap(129, 129, 129)
                                .addComponent(pizzaOrdreDoneButton))
                            .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(statusKokProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(kokPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(statusLabelKok)))
                    .addGroup(kokPanelLayout.createSequentialGroup()
                        .addComponent(jLabel23)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 476, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        getContentPane().add(kokPanel);
        kokPanel.setBounds(0, 0, 790, 530);

        jMenu1.setText("Filer");

        kundeMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icons/users.png"))); // NOI18N
        kundeMenuItem.setText("Opret/rediger kunde");
        kundeMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                kundeMenuItemActionPerformed(evt);
            }
        });
        jMenu1.add(kundeMenuItem);

        pizzaMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icons/pizza-icon.png"))); // NOI18N
        pizzaMenuItem.setText("Opret/rediger pizza");
        pizzaMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                pizzaMenuItemActionPerformed(evt);
            }
        });
        jMenu1.add(pizzaMenuItem);

        budMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icons/users.png"))); // NOI18N
        budMenuItem.setText("Opret/rediger Bud");
        budMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                budMenuItemActionPerformed(evt);
            }
        });
        jMenu1.add(budMenuItem);

        toppingMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icons/pizza-icon.png"))); // NOI18N
        toppingMenuItem.setText("Opret/rediger Topping");
        toppingMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                toppingMenuItemActionPerformed(evt);
            }
        });
        jMenu1.add(toppingMenuItem);

        ordreMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icons/note.png"))); // NOI18N
        ordreMenuItem.setText("Rediger Ordre");
        ordreMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ordreMenuItemActionPerformed(evt);
            }
        });
        jMenu1.add(ordreMenuItem);

        lukMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icons/shut-down.png"))); // NOI18N
        lukMenuItem.setText("Luk");
        lukMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                lukMenuItemActionPerformed(evt);
            }
        });
        jMenu1.add(lukMenuItem);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Skift bruger type");

        menubuttonGroup.add(kundeRadioButtonMenu);
        kundeRadioButtonMenu.setSelected(true);
        kundeRadioButtonMenu.setText("Kunde");
        kundeRadioButtonMenu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icons/users.png"))); // NOI18N
        kundeRadioButtonMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                kundeRadioButtonMenuActionPerformed(evt);
            }
        });
        jMenu2.add(kundeRadioButtonMenu);

        menubuttonGroup.add(budRadioButtonMenu);
        budRadioButtonMenu.setText("Bud");
        budRadioButtonMenu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icons/note.png"))); // NOI18N
        budRadioButtonMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                budRadioButtonMenuActionPerformed(evt);
            }
        });
        jMenu2.add(budRadioButtonMenu);

        menubuttonGroup.add(kokRadioButtonMenu);
        kokRadioButtonMenu.setText("Køkken");
        kokRadioButtonMenu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icons/pizza-icon.png"))); // NOI18N
        kokRadioButtonMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                kokRadioButtonMenuActionPerformed(evt);
            }
        });
        jMenu2.add(kokRadioButtonMenu);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    // <editor-fold desc="Hide IT!">
private void kundePanelComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_kundePanelComponentResized
    kundeScrollPane.setBounds(0, 0, kundePanel.getWidth(), kundePanel.getHeight());
    if (isAdmin || isKunde) {
        mainTable.getColumnModel().getColumn(0).setResizable(false);
        mainTable.getColumnModel().getColumn(0).setPreferredWidth(200);
        mainTable.getColumnModel().getColumn(1).setResizable(false);
        mainTable.getColumnModel().getColumn(1).setPreferredWidth(100);
        mainTable.getColumnModel().getColumn(2).setResizable(false);
        mainTable.getColumnModel().getColumn(2).setPreferredWidth(100);
        kundePanel.validate();
    }
}//GEN-LAST:event_kundePanelComponentResized

    private void kundeRadioButtonMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_kundeRadioButtonMenuActionPerformed
        kundePanel.setVisible(true);
        budPanel.setVisible(false);
        kokPanel.setVisible(false);
    }//GEN-LAST:event_kundeRadioButtonMenuActionPerformed

    private void budRadioButtonMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_budRadioButtonMenuActionPerformed
        kundePanel.setVisible(false);
        budPanel.setVisible(true);
        kokPanel.setVisible(false);
        tBudOrdreList.start();
    }//GEN-LAST:event_budRadioButtonMenuActionPerformed

    private void kokRadioButtonMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_kokRadioButtonMenuActionPerformed
        kundePanel.setVisible(false);
        budPanel.setVisible(false);
        kokPanel.setVisible(true);
        tBudOrdreList.stop();
        tKoekkenOrdreList.start();
    }//GEN-LAST:event_kokRadioButtonMenuActionPerformed

    private void pizzaMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pizzaMenuItemActionPerformed
        pizzaDialog.setVisible(true);
    }//GEN-LAST:event_pizzaMenuItemActionPerformed

    private void budMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_budMenuItemActionPerformed
        budDialog.setVisible(true);
    }//GEN-LAST:event_budMenuItemActionPerformed

    private void toppingMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_toppingMenuItemActionPerformed
        toppingDialog.setVisible(true);
    }//GEN-LAST:event_toppingMenuItemActionPerformed

    private void ordreMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ordreMenuItemActionPerformed
        ordreDialog.setVisible(true);
    }//GEN-LAST:event_ordreMenuItemActionPerformed

    private void lukMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lukMenuItemActionPerformed
        dispose();
    }//GEN-LAST:event_lukMenuItemActionPerformed

    private void pizzaGemButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pizzaGemButtonActionPerformed
        pizzaDialog.setVisible(false);
        int lillePris = Integer.parseInt(lillePizzaKosterTextField.getText());
        int mellemPris = Integer.parseInt(mellemPizzaKosterTextField.getText());
        int storPris = Integer.parseInt(storPizzaKosterTextField.getText());
        PizzaSize size1 = new PizzaSize(1, lillePris);
        PizzaSize size2 = new PizzaSize(1, mellemPris);
        PizzaSize size3 = new PizzaSize(1, storPris);
        ArrayList sizeList = new ArrayList();
        sizeList.add(size1);
        sizeList.add(size2);
        sizeList.add(size3);
        Pizza pizza = new Pizza(pizzanavn, sizeList, newPizzaToppingsList);
        try {
            dbh.addPizza(pizza);


        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "pizzaGemButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
        } catch (NullPointerException ex) {
            JOptionPane.showMessageDialog(null, "pizzaGemButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
        } catch (ArrayIndexOutOfBoundsException ex) {
            JOptionPane.showMessageDialog(null, "pizzaGemButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
        }

    }//GEN-LAST:event_pizzaGemButtonActionPerformed

    private void arrowButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_arrowButtonActionPerformed
        newPizzaToppingsList.add(toppingList1.getSelectedValue());
        toppingList2.setListData(newPizzaToppingsList.toArray());
    }//GEN-LAST:event_arrowButtonActionPerformed

    private void pizzaSletButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pizzaSletButtonActionPerformed
        pizzaDialog.setVisible(false);
    }//GEN-LAST:event_pizzaSletButtonActionPerformed

    private void pizzaButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pizzaButtonActionPerformed
        boolean findesPizza = true;
        pizzanavn = pizzaNavnTextField.getText();
        pizzaNavnTextField.setEnabled(false);
        try {
            findesPizza = dbh.doesPizzaExist(pizzanavn);


        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, sqlFejl + ex.getMessage(), "FEJL", 1);
        }
        if (!findesPizza) {
            lillePizzaKosterTextField.setEnabled(true);
            mellemPizzaKosterTextField.setEnabled(true);
            storPizzaKosterTextField.setEnabled(true);
            toppingList1.setEnabled(true);
            toppingList2.setEnabled(true);
            arrowButton.setEnabled(true);
            pizzaGemButton.setEnabled(true);
        } else {
            Pizza pizza = new Pizza();
            //kode til insert af data
            lillePizzaKosterTextField.setEnabled(true);
            mellemPizzaKosterTextField.setEnabled(true);
            storPizzaKosterTextField.setEnabled(true);
            toppingList1.setEnabled(true);
            toppingList2.setEnabled(true);
            arrowButton.setEnabled(true);
            pizzaGemButton.setEnabled(true);
            pizzaSletButton.setEnabled(true);
        }
    }//GEN-LAST:event_pizzaButtonActionPerformed

    private void budGemButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_budGemButtonActionPerformed
        budDialog.setVisible(false);
        try {
            if (aktivBud.getId() == 0) {

                dbh.addBud(aktivBud);

            } else {
                dbh.editBud(aktivBud);


            }
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "budGemButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
        } catch (NullPointerException ex) {
            JOptionPane.showMessageDialog(null, "budGemButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
        }
    }//GEN-LAST:event_budGemButtonActionPerformed

    private void budSletButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_budSletButtonActionPerformed
        budDialog.setVisible(false);
        try {
            dbh.deleteBud(aktivBud);
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "budGemButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
        } catch (NullPointerException ex) {
            JOptionPane.showMessageDialog(null, "budGemButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
        }
    }//GEN-LAST:event_budSletButtonActionPerformed

    private void budButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_budButtonActionPerformed
        boolean findesBud = false;
        budFornavn = budFornavnTextField.getText();
        budEfternavn = budEfternavnTextField.getText();
        //kode til at finde ud af om budet findes allerede og sætte ny
        budFornavnTextField.setEnabled(false);
        budEfternavnTextField.setEnabled(false);
        aktivBud = new Bud(budFornavn, budEfternavn);
        try {
            findesBud = dbh.doesBudExist(budFornavn, budEfternavn);
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "budButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
        } catch (NullPointerException ex) {
            JOptionPane.showMessageDialog(null, "budButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
        }
        if (!findesBud) {
            budGemButton.setEnabled(true);
        } else {
            try {
                dbh.getBud(aktivBud);


            } catch (SQLException ex) {
                JOptionPane.showMessageDialog(null, "budButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
            } catch (NullPointerException ex) {
                JOptionPane.showMessageDialog(null, "budButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
            }
            budGemButton.setEnabled(true);
            budSletButton.setEnabled(true);
            budNytEfternavnTextField.setEnabled(true);
            budNytFornavnTextField.setEnabled(true);
        }

    }//GEN-LAST:event_budButtonActionPerformed

    private void toppingGemButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_toppingGemButtonActionPerformed
        boolean findesTopping = false;
        try {
            findesTopping = dbh.doesToppingExist(toppingnavn);

            if (!findesTopping) {
                toppingDialog.setVisible(false);
                Topping topping = new Topping(toppingnavn);

                dbh.addTopping(topping);

            } else {

                dbh.editTopping(toppingnavn, toppingNytNavnTextField.getText());



            }
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "toppingGemButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
        } catch (NullPointerException ex) {
            JOptionPane.showMessageDialog(null, "toppingGemButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
        }
    }//GEN-LAST:event_toppingGemButtonActionPerformed

    private void toppingSletButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_toppingSletButtonActionPerformed
        try {
            dbh.deleteTopping(toppingnavn);


        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "toppingSletButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
        } catch (NullPointerException ex) {
            JOptionPane.showMessageDialog(null, "toppingSletButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
        }
        toppingDialog.setVisible(false);
    }//GEN-LAST:event_toppingSletButtonActionPerformed

    private void toppingButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_toppingButtonActionPerformed
        boolean findesTopping = false;
        toppingnavn = toppingNavnTextField.getText();
        try {
            findesTopping = dbh.doesToppingExist(toppingnavn);


        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, sqlFejl + ex.getMessage(), "FEJL", 1);
        } catch (NullPointerException ex) {
            JOptionPane.showMessageDialog(null, nullFejl + ex.getMessage(), "FEJL", 1);
        }
        toppingNavnTextField.setEnabled(false);
        if (!findesTopping) {
            toppingGemButton.setEnabled(true);
        } else {
            toppingGemButton.setEnabled(true);
            toppingSletButton.setEnabled(true);
            toppingNytNavnTextField.setEnabled(true);
        }
    }//GEN-LAST:event_toppingButtonActionPerformed

    private void kundeMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_kundeMenuItemActionPerformed
        kundeDialog.setVisible(true);
    }//GEN-LAST:event_kundeMenuItemActionPerformed

    private void kundeGemButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_kundeGemButtonActionPerformed
        kundeDialog.setVisible(false);
        String adresse = adresseTextField.getText();
        String bynavn = bynavnTextField.getText();
        int postnr = Integer.parseInt(postNrTextField.getText());
        int tlfnr = Integer.parseInt(tlfTextField.getText());
        Kunde kunde = new Kunde(kundeFornavn, kundeEfternavn, adresse, postnr, bynavn, tlfnr);
        dbh.addKunde(kunde);
    }//GEN-LAST:event_kundeGemButtonActionPerformed

    private void kundeSletButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_kundeSletButtonActionPerformed
        kundeDialog.setVisible(false);
    }//GEN-LAST:event_kundeSletButtonActionPerformed

    private void kundeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_kundeButtonActionPerformed
        boolean findesKunde = false;
        kundeFornavn = kundeFornavnTextField.getText();
        kundeEfternavn = kundeEfternavnTextField.getText();
        kundeFornavnTextField.setEnabled(false);
        kundeEfternavnTextField.setEnabled(false);
        kundeButton.setEnabled(false);
        try {
            findesKunde = dbh.doesKundeExist(kundeFornavn, kundeEfternavn);


        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "kundeButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
        } catch (NullPointerException ex) {
            JOptionPane.showMessageDialog(null, "kundeButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
        }
        if (!findesKunde) {
            adresseTextField.setEnabled(true);
            postNrTextField.setEnabled(true);
            bynavnTextField.setEnabled(true);
            kundeGemButton.setEnabled(true);
            tlfTextField.setEnabled(true);
        } else {

            //kode til insert af data
            adresseTextField.setEnabled(true);
            postNrTextField.setEnabled(true);
            bynavnTextField.setEnabled(true);
            kundeGemButton.setEnabled(true);
            tlfTextField.setEnabled(true);
            kundeSletButton.setEnabled(true);
        }

    }//GEN-LAST:event_kundeButtonActionPerformed

private void startPizzaButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startPizzaButtonActionPerformed
    if (pizzaDerBliverLavet.isEmpty() && pizzaDone.isEmpty()) {
        aktivOrdre.setStatus(2);
        try {
            dbh.setOrdreStatus(aktivOrdre);
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "startPizzaButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
        } catch (NullPointerException ex) {
            JOptionPane.showMessageDialog(null, "startPizzaButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
        }
    }
    try {
        pizzaDerBliverLavet.add(pizzaDerSkalLavesList.getSelectedValue());
        pizzaDerSkalLaves.remove(pizzaDerSkalLavesList.getSelectedIndex());
        pizzaDerSkalLavesList.setListData(pizzaDerSkalLaves.toArray());
        pizzaVedAtBliveLavetList.setListData(pizzaDerBliverLavet.toArray());

        statusKokProgressBar.setValue(aktivOrdre.getStatus());
        statusLabelKok.setText(aktivOrdre.ordreStatusTekst(aktivOrdre.getStatus()));
    } catch (NullPointerException ex) {
        JOptionPane.showMessageDialog(null, "startPizzaButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
    } catch (ArrayIndexOutOfBoundsException ex) {
        JOptionPane.showMessageDialog(null, "startPizzaButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
    }
    if (pizzaDerSkalLaves.isEmpty()) {
        startPizzaButton.setEnabled(false);
    }
}//GEN-LAST:event_startPizzaButtonActionPerformed

private void pizzaSetDoneButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pizzaSetDoneButtonActionPerformed
    try {
        pizzaDone.add(pizzaVedAtBliveLavetList.getSelectedValue());
        pizzaDerBliverLavet.remove(pizzaVedAtBliveLavetList.getSelectedIndex());
        pizzaVedAtBliveLavetList.setListData(pizzaDerBliverLavet.toArray());
        pizzaDerErDoneList.setListData(pizzaDone.toArray());
        statusKokProgressBar.setValue(aktivOrdre.getStatus());
        statusLabelKok.setText(aktivOrdre.ordreStatusTekst(aktivOrdre.getStatus()));
        if (pizzaDerBliverLavet.isEmpty() && pizzaDerSkalLaves.isEmpty()) {
            pizzaOrdreDoneButton.setEnabled(true);
        }
    } catch (NullPointerException ex) {
        JOptionPane.showMessageDialog(null, "Husk at vælge en pizza.", "FEJL", 1);
    } catch (ArrayIndexOutOfBoundsException ex) {
        JOptionPane.showMessageDialog(null, arrayIndexFejl + ex.getMessage(), "FEJL", 1);
    }
    if (pizzaDerBliverLavet.isEmpty()) {
        pizzaSetDoneButton.setEnabled(false);
    }
}//GEN-LAST:event_pizzaSetDoneButtonActionPerformed

private void pizzaOrdreDoneButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pizzaOrdreDoneButtonActionPerformed

    aktivOrdre.setStatus(3);
    try {
        dbh.setOrdreStatus(aktivOrdre);
    } catch (SQLException ex) {
        JOptionPane.showMessageDialog(null, "pizzaOrdreDoneButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
    } catch (NullPointerException ex) {
        JOptionPane.showMessageDialog(null, "Pizzaen er sendt til levering.", "FEJL", 1);
    }
    statusKokProgressBar.setValue(aktivOrdre.getStatus());
    statusLabelKok.setText(aktivOrdre.ordreStatusTekst(aktivOrdre.getStatus()));
    pizzaOrdreDoneButton.setEnabled(false);
    pizzaSetDoneButton.setEnabled(true);
    startPizzaButton.setEnabled(true);
    tKoekkenOrdreList.start();
    AlleOrdreList.setEnabled(true);
}//GEN-LAST:event_pizzaOrdreDoneButtonActionPerformed

private void bestilButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bestilButtonActionPerformed
    if (!bestillingsArrayList.isEmpty()) {
        bestilDialog.setVisible(true);
        bestilDialog.setLocationRelativeTo(null);
    } else {
        JOptionPane.showMessageDialog(null, "Der er ingen bestilling", "info", 3);
    }

}//GEN-LAST:event_bestilButtonActionPerformed

private void bestilMedTidButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bestilMedTidButtonActionPerformed
    bestilDialog.setVisible(false);
    DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    Calendar cal = Calendar.getInstance();
    Date d = cal.getTime();
    aktivOrdre.setBestillingDatoTid(dateFormat.format(d));
    cal.add(Calendar.MINUTE, 45);
    d = cal.getTime();
    aktivOrdre.setLeveringsDatoTid(dateFormat.format(d));
    try {
        dbh.addOrdre(aktivOrdre, (PizzaOrdre[]) aktivOrdre.getPizzaList().toArray(new PizzaOrdre[0]));
        updateKundeOrdre(aktivKunde);

    } catch (SQLException ex) {
        JOptionPane.showMessageDialog(null, "bestilMedTidButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
    } catch (NullPointerException ex) {
        JOptionPane.showMessageDialog(null, "bestilMedTidButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
    }
    aktivOrdre = new Ordre();
    aktivOrdre.setKundeId(aktivKunde.getKundeId());
    bestillingsArrayList = new ArrayList();
    bestillingsList.setListData(bestillingsArrayList.toArray());
}//GEN-LAST:event_bestilMedTidButtonActionPerformed

private void fjernPizzaButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fjernPizzaButtonActionPerformed
    try {
        aktivOrdre.removePizza(bestillingsList.getSelectedIndex());
        bestillingsArrayList.remove(bestillingsList.getSelectedIndex());
        prisArray.remove(bestillingsList.getSelectedIndex());
        bestillingsList.setListData(bestillingsArrayList.toArray());
        OrdreTotalPris();
    } catch (NullPointerException ex) {
        JOptionPane.showMessageDialog(null, "fjernPizzaButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
    } catch (ArrayIndexOutOfBoundsException ex) {
        JOptionPane.showMessageDialog(null, "fjernPizzaButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
    }
}//GEN-LAST:event_fjernPizzaButtonActionPerformed
    private void OrdreTotalPris() {
        pizzaTotalPris = 0;
        System.out.println(prisArray.size());
        for (int i = 0; i < prisArray.size(); i++) {
            pizzaTotalPris += (int) prisArray.get(i);
        }
        ialtLabel.setText("" + pizzaTotalPris + " Kr,-");
    }
private void addPizzaButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addPizzaButtonActionPerformed

    int count = 1;
    row = mainTable.getSelectedRow();
    int pRow = row;
    Pizza pizza;
    try {
        if (!(mainTable.getValueAt(pRow, 0) instanceof Spacer)) {
            while (!(mainTable.getValueAt(pRow, 0) instanceof Pizza)) {
                pRow--;
                count++;
            }
            pizza = (Pizza) mainTable.getValueAt(pRow, 0);

            PizzaOrdre pizzaordre = new PizzaOrdre(pizza, count, Integer.parseInt(pizzaAntalTextField.getText()));

            aktivOrdre.addPizza(pizzaordre);

            bestillingsArrayList.add(pizzaordre);

            // Denne liste bliver ikke opdateret?
            bestillingsList.setListData(bestillingsArrayList.toArray());


            int value = (int) mainTable.getValueAt(row, 2);
            prisArray.add(value);
            OrdreTotalPris();
        }
    } catch (NullPointerException ex) {
        JOptionPane.showMessageDialog(null, "addPizzaButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
    } catch (ArrayIndexOutOfBoundsException ex) {
        JOptionPane.showMessageDialog(null, "addPizzaButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
    }
    pizzaAntalTextField.setText("1");
}//GEN-LAST:event_addPizzaButtonActionPerformed
//</editor-fold>

    private void kundeOrderComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_kundeOrderComboBoxActionPerformed
        tKundeStatus.start();
    }//GEN-LAST:event_kundeOrderComboBoxActionPerformed

    private void updateKundeOrdreStatus() {
        Ordre ordre = (Ordre) kundeOrderComboBox.getSelectedItem();
        try {
            ordre = dbh.fetchOrdre(ordre.getOrdreId());
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "updateKundeOrdreStatus(): " + ex.getMessage(), "FEJL", 1);
        } catch (NullPointerException ex) {
            JOptionPane.showMessageDialog(null, "updateKundeOrdreStatus(): " + ex.getMessage(), "FEJL", 1);
        } catch (ClassCastException ex) {
            ordreBeskrivelseTextArea.setText("");
            statusKundeProgressBar.setValue(0);
            statusLabelKunde.setText("");
        }
        ordreBeskrivelseTextArea.setText(ordre.getOrdreBeskrivelse());
        statusKundeProgressBar.setValue(ordre.getStatus());
        statusLabelKunde.setText(ordre.ordreStatusTekst(ordre.getStatus()));
    }

    private void updateKundeOrdre(Kunde kunde) throws SQLException {
        ArrayList ko = dbh.kundeOrdreList(kunde.getKundeId());
        for (int i = 0;
                i < ko.size();
                i++) {
            Ordre ordre = (Ordre) ko.get(i);
            kundeOrderComboBox.addItem(ordre);
        }

    }

    private void updateBudOrdre() {
        try {
            waitToGetOnTheWayList = dbh.budOrdreList();
            kundeList1 = new ArrayList();
            for (int i = 0; i < waitToGetOnTheWayList.size(); i++) {
                kundeList1.add(dbh.getKunde(waitToGetOnTheWayList.get(i).getKundeId()));
            }
            frakokkenList.setListData(kundeList1.toArray());
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "updateBudOrdre(): " + ex.getMessage(), "FEJL", 1);
        } catch (NullPointerException ex) {
            JOptionPane.showMessageDialog(null, "updateBudOrdre(): " + ex.getMessage(), "FEJL", 1);
        }
    }

    private void updateKoekOrdre() {
        try {
            toppingList1.setListData(dbh.allToppingList().toArray());
            AlleOrdreList.setListData(dbh.aktivOrdreList().toArray());
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "updateKoekOrdre(): " + ex.getMessage(), "FEJL", 1);
        } catch (NullPointerException ex) {
            JOptionPane.showMessageDialog(null, "updateKoekOrdre(): " + ex.getMessage(), "FEJL", 1);
        }
    }

    private void AlleOrdreListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_AlleOrdreListValueChanged
        tKoekkenOrdreList.stop();
        AlleOrdreList.setEnabled(false);
        aktivOrdre = new Ordre();
        try {
            if (AlleOrdreList != null) {
                aktivOrdre = (Ordre) AlleOrdreList.getSelectedValue();
                aktivOrdre = dbh.fetchOrdre(aktivOrdre.getOrdreId());
                pizzaDerSkalLaves = aktivOrdre.getPizzaList();
                pizzaDerSkalLavesList.setListData(pizzaDerSkalLaves.toArray());
                statusKokProgressBar.setValue(aktivOrdre.getStatus());
                statusLabelKok.setText(aktivOrdre.ordreStatusTekst(aktivOrdre.getStatus()));
                aktivOrdre.setStatus(1);
                dbh.setOrdreStatus(aktivOrdre);
            }
        } catch (SQLException | NullPointerException ex) {
            //Skal ikke give en beske hvis listen er tom
        }
        pizzaDerBliverLavet = new ArrayList();
        pizzaVedAtBliveLavetList.setListData(pizzaDerBliverLavet.toArray());
        pizzaDone = new ArrayList();
        pizzaDerErDoneList.setListData(pizzaDone.toArray());
    }//GEN-LAST:event_AlleOrdreListValueChanged

    private void tilUdbringningButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tilUdbringningButtonActionPerformed
        try {

            aktivOrdre = (Ordre) waitToGetOnTheWayList.get(frakokkenList.getSelectedIndex());
            aktivOrdre.setStatus(4);

            dbh.setOrdreStatus(aktivOrdre);


            kundeList2.add(frakokkenList.getSelectedValue());
            kundeList1.remove(frakokkenList.getSelectedIndex());
            onTheWayList.add(waitToGetOnTheWayList.get(frakokkenList.getSelectedIndex()));
            waitToGetOnTheWayList.remove(frakokkenList.getSelectedIndex());

            frakokkenList.setListData(kundeList1.toArray());
            budUdbringningList.setListData(kundeList2.toArray());

        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "tilUdbringningButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
        } catch (NullPointerException ex) {
            JOptionPane.showMessageDialog(null, "tilUdbringningButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
        } catch (ArrayIndexOutOfBoundsException ex) {
            JOptionPane.showMessageDialog(null, "tilUdbringningButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
        }
    }//GEN-LAST:event_tilUdbringningButtonActionPerformed

    private void leveretButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_leveretButtonActionPerformed
        try {
            while (onTheWayList.size() > 0) {
                Ordre ordre = (Ordre) (onTheWayList.get(0));
                ordre.setStatus(5);
                dbh.setOrdreStatus(ordre);
                onTheWayList.remove(0);
                kundeList2.remove(0);
            }
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "leveretButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
        } catch (NullPointerException ex) {
            JOptionPane.showMessageDialog(null, "leveretButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
        } catch (ArrayIndexOutOfBoundsException ex) {
            JOptionPane.showMessageDialog(null, "leveretButtonActionPerformed(): " + ex.getMessage(), "FEJL", 1);
        }
        budUdbringningList.setListData(kundeList2.toArray());
    }//GEN-LAST:event_leveretButtonActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;












                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
            }
        });
    }

    class ActionListenerImpl implements ActionListener {

        public ActionListenerImpl() {
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            if (isKunde) {
                updateKundeOrdreStatus();
                System.out.println("updateKundeOrdreStatus()");
            }

            if (isAdmin || isBud) {
                int selectedIndex = 0;
                if (!frakokkenList.isSelectionEmpty()) {
                    selectedIndex = frakokkenList.getSelectedIndex();
                }
                updateBudOrdre();
                frakokkenList.setSelectedIndex(selectedIndex);
                System.out.println("updateBudOrdre()");
            }

            if (isAdmin || isKok) {
                updateKoekOrdre();
                System.out.println("updateKoekOrdre()");
            }
        }
    }
// <editor-fold desc="Variables declaration - do not modify ">
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JList AlleOrdreList;
    private javax.swing.JButton addPizzaButton;
    private javax.swing.JTextField adresseTextField;
    private javax.swing.JLabel aktivKundeNavnLabel;
    private javax.swing.JButton arrowButton;
    private javax.swing.JButton bestilButton;
    private javax.swing.JDialog bestilDialog;
    private javax.swing.JButton bestilMedTidButton;
    private javax.swing.JList bestillingsList;
    private javax.swing.JButton budButton;
    private javax.swing.JDialog budDialog;
    private javax.swing.JTextField budEfternavnTextField;
    private javax.swing.JTextField budFornavnTextField;
    private javax.swing.JButton budGemButton;
    private javax.swing.JMenuItem budMenuItem;
    private javax.swing.JTextField budNytEfternavnTextField;
    private javax.swing.JTextField budNytFornavnTextField;
    private javax.swing.JPanel budPanel;
    private javax.swing.JRadioButtonMenuItem budRadioButtonMenu;
    private javax.swing.JButton budSletButton;
    private javax.swing.JList budUdbringningList;
    private javax.swing.JTextField bynavnTextField;
    private javax.swing.JButton fjernPizzaButton;
    private javax.swing.JList frakokkenList;
    private javax.swing.JLabel ialtLabel;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JComboBox jComboBox2;
    private javax.swing.JComboBox jComboBox3;
    private javax.swing.JComboBox jComboBox4;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JScrollPane jScrollPane9;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JPanel kokPanel;
    private javax.swing.JRadioButtonMenuItem kokRadioButtonMenu;
    private javax.swing.JButton kundeButton;
    private javax.swing.JDialog kundeDialog;
    private javax.swing.JTextField kundeEfternavnTextField;
    private javax.swing.JTextField kundeFornavnTextField;
    private javax.swing.JButton kundeGemButton;
    private javax.swing.JMenuItem kundeMenuItem;
    private javax.swing.JComboBox kundeOrderComboBox;
    private javax.swing.JPanel kundePanel;
    private javax.swing.JRadioButtonMenuItem kundeRadioButtonMenu;
    private javax.swing.JScrollPane kundeScrollPane;
    private javax.swing.JButton kundeSletButton;
    private javax.swing.JButton leveretButton;
    private javax.swing.JTextField lillePizzaKosterTextField;
    private javax.swing.JMenuItem lukMenuItem;
    private javax.swing.JTextField mellemPizzaKosterTextField;
    private javax.swing.ButtonGroup menubuttonGroup;
    private javax.swing.JTextArea ordreBeskrivelseTextArea;
    private javax.swing.JDialog ordreDialog;
    private javax.swing.JMenuItem ordreMenuItem;
    private javax.swing.JTextField pizzaAntalTextField;
    private javax.swing.JButton pizzaButton;
    private javax.swing.JList pizzaDerErDoneList;
    private javax.swing.JList pizzaDerSkalLavesList;
    private javax.swing.JDialog pizzaDialog;
    private javax.swing.JButton pizzaGemButton;
    private javax.swing.JMenuItem pizzaMenuItem;
    private javax.swing.JTextField pizzaNavnTextField;
    private javax.swing.JButton pizzaOrdreDoneButton;
    private javax.swing.JButton pizzaSetDoneButton;
    private javax.swing.JButton pizzaSletButton;
    private javax.swing.JList pizzaVedAtBliveLavetList;
    private javax.swing.JTextField postNrTextField;
    private javax.swing.JButton startPizzaButton;
    private javax.swing.JProgressBar statusKokProgressBar;
    private javax.swing.JProgressBar statusKundeProgressBar;
    private javax.swing.JLabel statusLabelKok;
    private javax.swing.JLabel statusLabelKunde;
    private javax.swing.JTextField storPizzaKosterTextField;
    private javax.swing.JButton tilUdbringningButton;
    private javax.swing.JTextField tlfTextField;
    private javax.swing.JButton toppingButton;
    private javax.swing.JDialog toppingDialog;
    private javax.swing.JButton toppingGemButton;
    private javax.swing.JList toppingList1;
    private javax.swing.JList toppingList2;
    private javax.swing.JMenuItem toppingMenuItem;
    private javax.swing.JTextField toppingNavnTextField;
    private javax.swing.JTextField toppingNytNavnTextField;
    private javax.swing.JScrollPane toppingScrollPane1;
    private javax.swing.JScrollPane toppingScrollPane2;
    private javax.swing.JButton toppingSletButton;
    // End of variables declaration//GEN-END:variables
// </editor-fold>
}
